#include "startgame.h"
#include "ui_startgame.h"
#include"QDebug"
#include<QString>
#include <QDialog>
#include <QIcon>
StartGame::StartGame(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::StartGame)
{
QIcon icon;
icon.addFile(":/picture1/huiji.png");
this->setWindowIcon(icon);
    this->setWindowTitle("飞机大战");

           ui->setupUi(this);

}

StartGame::~StartGame()
{
    delete ui;

}
void StartGame::on_pushButtonStart_clicked()
{
    this->close();
    MainScene *m;
    m=new MainScene();
    m->show();

}
void StartGame::on_pushButtonhelp_clicked()
{
    QTextBrowser *rules = new QTextBrowser;
    QIcon icon;
    icon.addFile(":/picture1/huiji.png");
    rules->setWindowIcon(icon);

    rules->setWindowTitle(QApplication::translate("rules", "规则", nullptr));
    rules->setStyleSheet("color:  rgb(0, 220, 255);");
    rules->setText(
               "游戏规则如下：玩家使用键盘上下左右键操作控制对象，可以通过撞击一下或击中一次消灭敌机，子弹射击与撞击得分一致，但撞击会扣除玩家相应血量。每当有敌机越过游戏界面下限，则视为撞击一次，扣除玩家相应血量。每当玩家被敌机射中一次扣除相应血量，玩家血量归零则游戏结束。");
    rules->show();
}

void StartGame::on_pushButtonExit_clicked()
{
    exit(0);
}



